﻿using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;

namespace Beeflys.Generator
{
    public static class USyntaxTrees
    {
        public static void Parse(CSharpCompilation compilation)
        {
            Mapper.Namespace = compilation.AssemblyName;
            
            var trees = compilation.SyntaxTrees;
            foreach (SyntaxTree tree in trees)
            {
                SemanticModel model = compilation.GetSemanticModel(tree);
                CompilationUnitSyntax root = (CompilationUnitSyntax)tree.GetRoot();
                
                USyntaxInfo.Parse(model, root);
            }
        }
    }
}